Suppose a person want to travel from one city to another with are connected by several paths , these kind of problems are called Shortest - Path problem , in these kind of problems we are given a weighted graph G = (V,E) with a weight fuction and weight of path is sum of weights of its costituent edges.
Dijkstra's Algorithm
Working of Algorithm
Execution of the Dijkstra's Algorithm
The shortest path estimates are shown within the vertices. and red edges indicate predeccesor values : if edge (u,v) is red ,then parent of v is u.green vertices are in the set S,and the blue vertices are in the Priority Queue Q = V-S.
(a) The situation just before the first iteration of the while loop of lines 4-8.The shaded vertex has minimum d value and is choosen as vertex u in line 5.
(b>-(f) The situation after each succesive iteration of the while loop.The green vertex in each part is choosen as vertex u in line 5 of the next iteration.
Run Animation
Keys to Home
Dijkstra's Graph Algorithm
This tutorial was written by Abhishek Goyal,Marghoob Mohiyuddin,Pooja Nath and Ruchi Saran |
Please email comments to:
[email protected][email protected] |